package com.sikaryofficial.backend.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sikaryofficial.backend.domain.dto.req.store.StoreCommentReplyListReq;
import com.sikaryofficial.backend.domain.dto.resp.StoreCommentReplyDTO;
import com.sikaryofficial.backend.domain.vo.EvaluateReplyCount;
import com.sikaryofficial.backend.domain.vo.store.CommentReplyCount;
import com.sikaryofficial.backend.mapper.StoreCommentReplyMapper;
import com.sikaryofficial.backend.domain.entity.StoreCommentReply;
import com.sikaryofficial.backend.service.IStoreCommentReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;


@Service
public class StoreCommentReplyService extends ServiceImpl<StoreCommentReplyMapper, StoreCommentReply> implements IStoreCommentReplyService {

	@Autowired
	private StoreCommentReplyMapper storeCommentReplyMapper;

	/**
	 * 根据评论ID查询回复数量
	 * @param commentIds 评论ID列表
	 * @param userId 用户ID
	 * @return 回复数量
	 */
	@Override
	public List<CommentReplyCount> countByCommentId(List<Long> commentIds, Long userId) {
		return storeCommentReplyMapper.countByCommentId(commentIds, userId);
	}

	/**
	 * 回复列表
	 * @param customerPage 分页对象
	 * @param req 请求参数
	 * @return 回复列表
	 */
	@Override
	public IPage<StoreCommentReplyDTO> replyList(Page<StoreCommentReplyDTO> customerPage, StoreCommentReplyListReq req) {
		return storeCommentReplyMapper.replyList(customerPage, req, req.getUserId());
	}

	/**
	 * 根据评论ID查询回复列表
	 * @param commentIds 评论ID列表
	 * @param limitNum 回复数量
	 * @param userId 用户ID
	 * @return 回复列表
	 */
	@Override
	public List<StoreCommentReplyDTO> queryByCommentId(List<Long> commentIds, int limitNum, Long userId) {
		return storeCommentReplyMapper.queryByCommentId(commentIds, limitNum, userId);
	}

}
